<?php

declare(strict_types=1);

namespace App\Request\User;

use Hyperf\Validation\Request\FormRequest;

class AccountSaveRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'id' => 'nullable',
            'account_name' => 'required',
            'remark' => 'nullable',
            'is_default' => 'nullable|in:1,2',
            'amount' => 'nullable',
        ];
    }

    public function messages(): array
    {
        return [
            'account_name.required' => '账册名称不能为空',
            'is_default.in' => '默认账册参数错误',
        ];
    }
}
